﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Serious
{
    public class Sword
    {
        public Cylinder parent;

        public Single dist;
        public Single blah;
        public Single roll;

        public Single length;
        public Single radius;

        public BasicModel model;

        public Matrix transformation
        {
            get
            {
                return Matrix.CreateTranslation(new Vector3(0.0f, 0.0f, length / 2.0f + dist)) *
                       Matrix.CreateRotationY(MathHelper.PiOver2) *
                       Matrix.CreateRotationZ(MathHelper.ToRadians(blah) - MathHelper.PiOver2) *
                       Matrix.CreateRotationX(-MathHelper.ToRadians(roll));
            }
        }

        public Sword (Cylinder parent, Single dist)
        {
            this.parent = parent;

            this.dist = dist;

            this.blah = 0.0f;
            this.roll = 0.0f;

            this.length = 2.0f;
            this.radius = 0.0625f;

            this.model = BasicModel.GenerateColoredCylinderModel(16, radius, length / 2.0f, Color.Gray);
        }

        public void Draw (GameTime gameTime, GraphicsDevice device)
        {
            model.Draw(device);
        }
    }
}
